<template>
	<view class="orderDetails" v-show="account.user_money != undefined ? true : false">	
		<view class="top">
			<view class="state">
				<view class="right">
					<text>{{info.order_status_name}}</text>
					<text class="time" v-if="info.order_status==0">下单后请30分钟内付款，超时订单将自动关闭</text>
				</view>
			    <image v-if="info.order_status==0" src="https://hdsq.aoorange.cn/attachment/xcx/icon/order_bg.png" mode="aspectFill"></image>
				<image v-if="info.order_status==1" src="https://hdsq.aoorange.cn/attachment/xcx/icon/order_bg2.png" mode="aspectFill"></image>
				<image v-if="info.order_status==2||info.order_status==3" src="https://hdsq.aoorange.cn/attachment/xcx/icon/order_bg1.png" mode="aspectFill"></image>
				<image v-if="info.order_status==4" src="https://hdsq.aoorange.cn/attachment/xcx/icon/order_ok.png" mode="aspectFill"></image>
			</view>
			<view class="address" v-if="info.isOwn == 1 && info.shipping_type == 1">
				<image src="https://hdsq.aoorange.cn/attachment/xcx/icon/address.png" mode="widthFix"></image>
				<view class="right" @click="showMap()">
					<view class="txt">
						<text>收货人：{{info.receiver_name}}</text>
						<text>{{info.receiver_mobile}}</text>
					</view>
					<view class="txt1">
						收货地址：{{info.receiver_address}}
					</view>
					<view class="jt"></view>
				</view>
			</view>
		</view>
		<view class="goods" style="border-bottom: 1upx solid #ddd;" @click="jump(info.merchantId == 0 ? 'store' : 'store_view', info.merchantId)">
			<image :src="info.merchantPicture" mode="aspectFill" style="width: 50upx;height: 50upx;"></image>
			<text>{{info.merchantName}}</text>
		</view>
        <view v-if="info.order_status>=4" v-for="(comboItem,index) in info.comboList" :key="index">
            <view class="title" style="padding-top: 20rpx; padding-left: 36rpx;">{{comboItem.title}}</view>
            <view class="goods" v-for="(item,index2) in comboItem.productList" :key="index2" @click="jump(item.sku_id > 0 ? 'product_view' : 'bag_view', 'id='+item.product_id+'&merchantId='+info.merchantId)">
                <image :src="item.product_picture" mode="aspectFill" ></image>
                <view class="right">
                    <view class="right-p">
						<span v-if="item.reductionName != ''" style="background: rgba(235, 89, 56, 1); color: #ffffff; padding: 0 10rpx;margin-right: 10rpx;">{{item.reductionName}}</span>
						{{item.product_name}}
					</view>
                    <view class="size">
                        <text>{{item.sku_name}}</text>
                        <text>{{item.price}}x{{item.actual_num}}</text>
                        <text>{{item.status_name}}</text>
                    </view>
                    <text class="num">
                        {{item.adjust_money > 0 ? '￥'+item.adjust_money : ''}}
                    </text>
                </view>
            </view>
            <view v-if="info.isOwn == 1 && (info.shipping_type == 1 || info.shipping_type == 2)" style="padding: 20rpx;font-size: 26rpx; color: #797979; border-bottom: 1rpx #ebecf0 solid;">
                {{info.payInfo.comboList[comboItem.comboKey].remark}}
            </view>
			<view v-if="info.isOwn == 0 && info.rewardRemark != ''" style="padding: 20rpx;font-size: 26rpx; color: #797979; border-bottom: 1rpx #ebecf0 solid;">
			    {{info.rewardRemark}}
			</view>
        </view>
        <view v-if="info.order_status < 4" class="goods" v-for="(item,index2) in info.product_list" :key="index2" 
			@click="jump(item.sku_id > 0 ? 'product_view' : 'bag_view', 'id='+item.product_id+'&merchantId='+info.merchantId)">
            <image :src="item.product_picture" mode="aspectFill" ></image>
            <view class="right">
                <view class="right-p">
        			<span v-if="item.reductionName != ''" style="background: rgba(235, 89, 56, 1); color: #ffffff; padding: 0 10rpx;margin-right: 10rpx;">{{item.reductionName}}</span>
        			{{item.product_name}} 
        		</view>
                <view class="size">
                    <text>{{item.sku_name}}</text>
                    <text>{{item.price}}x{{item.actual_num}}</text>
                    <text>{{item.status_name}}</text>
                </view>
                <text class="num">
                    {{item.adjust_money > 0 ? '￥'+item.adjust_money : ''}}
                </text>
            </view>
        </view>
		<view class="line">
			<text>商品总金额</text>
			<text>￥{{info.payInfo.product_money}}</text>
		</view>
		<view class="line" v-if="info.isOwn == 1 && info.shipping_type == 1">
			<text>订单邮费</text>
			<view class="youFei">
				<view>
					{{info.payInfo.shipping_money > 0 ? '+￥'+info.payInfo.shipping_money : "包邮"}}
				</view>
				<view v-if="info.order_status == 1" style="font-size: 20rpx;margin-top: 10rpx;color: #999999;">
					预计 1 ~ 3 个工作日发货
				</view>
			</view>
		</view>
		<view class="line" v-if="info.payInfo.coupon_money > 0">
			<text>优惠券抵扣</text>
			<text>-{{'￥'+info.payInfo.coupon_money}}</text>
		</view>
		<view class="line" v-if="info.payInfo.reduction_money > 0">
			<text>减免金额</text>
			<text>-{{'￥'+info.payInfo.reduction_money}}</text>
		</view>
		<view class="line" v-if="info.payInfo.discount_money > 0">
			<text>折扣扣减</text>
			<text>-{{'￥'+info.payInfo.discount_money}}</text>
		</view>
		<view class="line" v-if="info.isOwn == 1 && info.payInfo.pay_status == 1 && info.payInfo.use_hdq > 0">
			<text>互动券抵扣</text>
			<text>-{{'￥'+info.payInfo.use_hdq}}</text>
		</view>
		<view class="line" v-if="info.isOwn == 1 && info.payInfo.pay_status == 1 && info.payInfo.pay_tea_money > 0">
			<text>中茶抵扣</text>
			<text>-{{'￥'+info.payInfo.pay_tea_money}}</text>
		</view>
		<view class="line" v-if="info.isOwn == 1 && info.payInfo.reward_tea > 0">
			<text>获取中茶</text>
			<text>{{info.payInfo.reward_tea}}g = ￥{{info.payInfo.reward_tea_money}}</text>
		</view>
        <view class="line" v-if="info.isOwn == 1 && info.payInfo.reward_green > 0">
        	<text>获取活跃度</text>
        	<text>{{info.payInfo.reward_green}}</text>
        </view>
		<view class="line" v-if="info.isOwn == 1 && info.payInfo.pay_status == 1 && info.payInfo.pay_money > 0">
			<text>{{info.payInfo.pay_type_name}}</text>
			<text>{{'￥'+info.payInfo.pay_money}}</text>
		</view>
		<view class="line" v-if="info.isOwn == 1 && info.payInfo.pay_status == 0">
			<text>还需支付</text>
			<text>{{'￥'+info.payInfo.total_money}}</text>
		</view>
		<!-- <view class="pic">
			<text>合计：</text>
			<text>{{'￥'+info.payInfo.order_money}}</text>
		</view> -->
		<view class="common" v-if="info.isOwn == 1 && (info.shipping_type == 1 || info.shipping_type == 2)">
			<text>买家留言</text>
			<text>{{info.buyer_message}}</text>
		</view>
        <view class="common" v-if="info.isOwn == 1 && info.shipping_type == 3 && info.buyer_invoice != ''">
        	<text style="max-width: 98vw;">{{info.buyer_invoice}}</text>
        </view>
		<view class="info" style="padding: 0;">
		<button class="contact"  open-type="contact">
			<uni-icons type="chatboxes" color="#0095df" size="20" style="margin-right: 10upx;"></uni-icons>
			
			<text style="font-size: 32rpx;">联系客服</text>
		</button>
		</view>
		<view class="info" v-if="info.isOwn == 1 && info.shipping_type == 2">
			<text>自提信息：</text>
			<view class="address" style="padding: 20rpx 30rpx;border-bottom: 1rpx solid #ccc;">
				<view class="right" @click="showMap()">
					<view class="txt">
						<text></text>
						<text>提货点：{{info.receiver_name}}</text>
						<text>{{info.receiver_mobile}}</text>
					</view>
					<view class="txt1">
						提货地址：{{info.receiver_address}}
					</view>
				</view>
			</view>
			<view class="pickupView" v-if="info.pickList.length > 0">
				<view>自提码</view>
				<view>自提时间</view>
				<view>操作</view>
			</view>
			<view class="pickupView" v-if="info.pickList.length > 0" v-for="(pickItem, pk) in info.pickList" :key="pk">
				<view>{{pickItem.pickupCode}}</view>
				<view>{{pickItem.pickup_time}}</view>
				<view @click="showPickCode(pk)">{{pickItem.status == 1 ? '已提货' : '展示自提码'}}</view>
			</view>
		</view>
		<view class="info">
			<text>订单信息：</text>
			<text>订单号码：{{info.order_sn}}</text>
			<text>下单时间：{{info.create_time}}</text>
			<text v-if="info.pay_time != ''">支付时间：{{info.pay_time}}</text>
			<text v-if="info.consign_time != ''">发货时间：{{info.consign_time}}</text>
			<text v-if="info.isOwn == 1 && info.delivery_type == 1">物流信息：{{info.delivery_company + '：' + info.delivery_no}}</text>
			<text v-if="info.isOwn == 1 && info.delivery_type === '0'">无需物流</text>
			<text v-if="info.sign_time != ''">签收时间：{{info.sign_time}}</text>
			<text v-if="info.cancel_time != ''">取消时间：{{info.cancel_time}}</text>
		</view>
		<view class="bot" v-if="info.isOwn == 1 && info.button_list.length > 0">
			<view v-if="info.button_list.length > 0" :class="info.button_list.length == 1 ? 'txt1' : 'txt2'">
				<text v-for="(button,index2) in info.button_list" :key="index2" @click="operate(button.type, info.id)">{{button.name}}</text>
			</view>
		</view>
		<uni-popup ref="popup" type="bottom">
			<view class="pay_type">
				<image @click="close" class="close" :src="'https://hdsq.aoorange.cn/attachment/xcx/icon/close1.png'" mode="aspectFill"></image>
				<view class="title">选择支付方式</view>
				<view class="paypir">
					<text>应付金额</text>
					<text>￥{{pay_money}}</text>
				</view>
				<view class="line2"  v-if="check_use_hdq == 1 && (deduction_hdq_money > 0 || is_use_hdq == 1)"  @click="setUseOther(1)">
					<text>使用互动券 {{use_hdq}} 抵扣金额 ￥{{use_hdq}}</text>
					<view :class="is_use_hdq == 1 ?'check':'nocheck'"></view>
				</view>
				<view class="line2"  v-if="tea_pay_rule.is_use_tea == 1 && check_use_tea == 1 && (deduction_tea_money > 0 || check_use_tea == 1)"  @click="setUseOther(2)">
					<view>使用价值为 {{use_tea}} 的中茶 抵扣金额￥{{tea_money}}(手续费:{{tea_process}})
					<br />
					{{tea_pay_rule.remark}}</view>
					<view :class="is_use_tea == 1 ?'check':'nocheck'"></view>
				</view>
				<view class="line2" v-if="pay_money > 0">
					<text>余额支付 - 当前余额：{{account.user_money}}</text>
					<view :class="pay_type == 5 ?'sel':'nosel'" @click="selPayType(5)" v-if="Number(account.user_money) >= Number(pay_money)"></view>
					<text v-else @click="jump('on_line_recharge')">余额不足</text>
				</view>
				<view class="line2" v-if="pay_money > 0">
					<text>在线微信支付</text>
					<view :class="pay_type == 1 ?'sel':'nosel'" @click="selPayType(1)"></view>
				</view>
				<view :style="'height:' + bottomHeight + 'rpx;'" class="pay_bot" @click="subPay()">确认支付</view>
			</view>
		</uni-popup>
		

		<uni-popup ref="pickupCode">
			<view class="show pickupCode-box">
				<view class="title">提货码</view>
				<image class="img" :src="pickupCodeImg" ></image>
				<view class="pickupCode-t">{{pickupCode}}</view>
				<view class="btn" @click="pickupCodeClose()">
					<text>确认</text>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	var _self;
	import serve from '../../static/request.js';
	import storage from '../../static/appkey.js';
	import common from '../../static/jump.js';
	export default {
		data() {
			return {
				goodsList: [{}, {}],
				type: 0,
				id : 0,
				info : {
					order_status: -1,
					order_status_name: '',
					merchantName: '',
					receiver_name: '',
					receiver_mobile: '',
					receiver_region_name: '',
					receiver_address: '',
					product_money: 0,
					coin_money: 0,
					shipping_money: 0,
                    shipping_type: 1,
                    buyer_invoice: '',
					order_money: 0,
					buyer_message: ''
				},
				account: {},
				pay_money: 0,
				payInfo : {},
				user_hdq: 0,
				user_tea: 0,
				use_hdq: 0,
				use_tea: 0,
				tea_money: 0,
				tea_process: 0,
				tea_pay_rule: {},
				is_use_hdq: 0,
				is_use_tea: 0,
				check_use_hdq: 0,
				check_use_tea: 0,
				deduction_hdq_money: 0,
				deduction_tea_money: 0,
				pay_type: 1,
				isShow: true,
				pickupCodeImg: '../../static/img/loading.png',
				pickupCode: '提货码',
			}
		},
		methods: {
			getInfo() {
				uni.showLoading({
					title: '加载中···',
					mask: true
				});
				serve.request({
					url: '/member/order/view',
					data: {
						appkey: uni.getStorageSync('appkey'),
						'access-token': uni.getStorageSync('access-token'),
						id: _self.id
					}
				}).then(res => {
					uni.hideLoading();
					if(res.code != 200) {
						uni.showToast({
							title:res.message,
							icon: 'none',
							success() {
								setTimeout(function () {
									common.jump('store_order_list')
								}, 2000) 
							}
						});
					}
					_self.info = res.data;
					console.info(_self.info.product_list);
					_self.payInfo = _self.info.payInfo;
				});
			},
			searchMemberInfo() {
				serve.request({
					url: '/member/member/account',
					data: {
						appkey: uni.getStorageSync('appkey'),
						'access-token': uni.getStorageSync('access-token')
					}
				}).then(res => {
					_self.account = res.data;
					_self.getTeaUseInfo();
				});
			},
			numFilter (value) {
				let tempVal = parseFloat(value).toFixed(3);
				let realVal = tempVal.substring(0, tempVal.length - 1);
				return realVal;
			},
			showMap() {
				_self.isShow = false;
				uni.openLocation({
				    latitude: Number(this.info.receiver_latitude),
				    longitude: Number(this.info.receiver_longitude),
				    success: function (res) {
				        console.log(res);
				    }
				});
			},
			setUseOther(type) {
				if(type == 1) {
					_self.is_use_hdq = _self.is_use_hdq == 1 ? 0 : 1;
				} else {
					_self.is_use_tea = _self.is_use_tea == 1 ? 0 : 1;
				}
				_self.calculationTotalMoney();
			},
			getTeaUseInfo() {
				serve.request({
					url: '/member/member/get-tea-use-info',
					data: {
						appkey: uni.getStorageSync('appkey'),
						'access-token': uni.getStorageSync('access-token'),
					}
				}).then(res => {
					_self.tea_pay_rule = res.data;
				});
			},
			operate(operateType, operateId) {
				if(operateType == 'order_cancel') {
					uni.showModal({
					    title: '提示',
					    content: '您确定取消该订单吗',
					    success: function (res) {
					        if (res.confirm) {
					            serve.request({
									url: '/member/order/cancel',
									data:{
										appkey: uni.getStorageSync('appkey'),
										'access-token': uni.getStorageSync('access-token'),
										id:operateId,
									}
								}).then(res => {
									uni.showToast({
										title:res.message,
										icon: 'none'
									});
									if(res.code == 200) {
										_self.getInfo();
										_self.$forceUpdate();
									}
								});
					        } 
					    }
					});
					return ;
				} else if(operateType == 'order_pay'){
					_self.is_use_hdq = 0;
					_self.is_use_tea = 0;
					_self.calculationTotalMoney();
					_self.$refs.popup.open();
					return ;
				} else if(operateType == 'tip_delivery'){
					serve.request({
						url: '/member/order/tip-delivery',
						data:{
							appkey: uni.getStorageSync('appkey'),
							'access-token': uni.getStorageSync('access-token'),
							id:operateId,
						}
					}).then(res => {
						uni.showToast({
							title:res.message,
							icon: 'none'
						});
						if(res.code == 200) {
							_self.getInfo();
							_self.$forceUpdate();
						} 
					});
				} else if(operateType == 'copy_delivery'){
					let express_no = _self.info.delivery_no;
					uni.setClipboardData({
						data: express_no,
						success: function (){
							uni.showToast({
								title: '复制成功',
								icon: 'none',
							});
						},
						fail:function(){
							uni.showToast({
								title: '对不起，您微信当前版本不支持复制功能',
								icon: 'none',
							});
						}
					});
					uni.getClipboardData({
					    success: function (res) {
					        console.log(res.data);
					    }
					});
				} else if(operateType == 'select_delivery'){
					uni.navigateToMiniProgram({
						appId: 'wx6885acbedba59c14',
						path: 'pages/index/index?source=third_xcx',
						envVersion: 'release',
						success(res) {
							console.log('跳转成功');
						}
					})
				} else if(operateType == 'task_delivery'){
					uni.showModal({
					    title: '提示',
					    content: '您确定该订单已确定收货吗',
					    success: function (res) {
					        if (res.confirm) {
					            serve.request({
					            		url: '/member/order/take-delivery',
					            		data:{
											appkey: uni.getStorageSync('appkey'),
											'access-token': uni.getStorageSync('access-token'),
											id:operateId,
										}
					            	}).then(res => {
										uni.showToast({
											title:res.message,
											icon: 'none'
										});
					            		if(res.code == 200) {
											_self.getInfo();
											_self.$forceUpdate();
					            		} 
					            	});
					        } 
					    }
					});
					return ;
				} else if(operateType == 'show_pickup'){
					let pickList = _self.info.pickList;
					for(let i = 0; i < pickList.length; i++) {
						let pickItem = pickList[i];
						if(pickItem.status == 0) {
							_self.pickupCodeImg = pickItem.pickupImgUrl;
							_self.pickupCode = pickItem.pickupCode;
							_self.$refs.pickupCode.open();
							return false;
						}
					}
					return ;
				} else if(operateType == 'confirm_pickup'){
                    uni.showModal({
                        title: '提示',
                        content: '您确定该订单已确定收货吗',
                        success: function (res) {
                            if (res.confirm) {
                                serve.request({
                                    url: '/member/order/confirm-pickup',
                                    data:{
                                        appkey: uni.getStorageSync('appkey'),
                                        'access-token': uni.getStorageSync('access-token'),
                                        id:operateId,
                                    }
                                }).then(res => {
                                    uni.showToast({
                                        title:res.message,
                                        icon: 'none'
                                    });
                                    if(res.code == 200) {
                                        _self.getInfo();
                                        _self.$forceUpdate();
                                    } 
                                });
                            }
                        },
                    });
                } else if(operateType == 'confirm_finish'){
                    uni.showModal({
                        title: '提示',
                        content: '您确定该订单已确定完成吗',
                        success: function (res) {
                            if (res.confirm) {
                                serve.request({
                                    url: '/member/order/confirm-finish',
                                    data:{
                                        appkey: uni.getStorageSync('appkey'),
                                        'access-token': uni.getStorageSync('access-token'),
                                        id:operateId,
                                    }
                                }).then(res => {
                                    uni.showToast({
                                        title:res.message,
                                        icon: 'none'
                                    });
                                    if(res.code == 200) {
                                        _self.getInfo();
                                        _self.$forceUpdate();
                                    } 
                                });
                            }
                        },
                    });
                } else if(operateType == 'evaluate_order'){
					common.jump('evaluate_order', operateId);
				}
			},
			/* 展示码关闭按钮 */
			pickupCodeClose(){
				this.$refs.pickupCode.close();
			},
			showPickCode(pk) {
				let pickItem = _self.info.pickList[pk];
				if(pickItem.status == 1) {
					return ;
				}
				_self.pickupCodeImg = pickItem.pickupImgUrl;
				_self.pickupCode = pickItem.pickupCode;
				_self.$refs.pickupCode.open();
				return false;
			},
			selPayType(type) {
				_self.pay_type = type;
			},
			close() {
				_self.$refs.popup.close();
			},
			subPay() {
				serve.request({
					url: '/order/pay/reset-pay',
					data: {
						appkey: uni.getStorageSync('appkey'),
						'access-token': uni.getStorageSync('access-token'),
						'data_type' : 'order_pay',
						'data_id' : _self.id,
						is_use_hdq: _self.is_use_hdq,
						is_use_tea: _self.is_use_tea,
						pay_type: _self.pay_type
					}
				}).then(res => {
					if(res.code == 200) {
						if(res.data.is_pay == 1) {
							_self.wechatPay(res.data.dataId);
							return ;
						}
						_self.getInfo();
						_self.$refs.popup.close();
						return ;
					} 
					uni.showToast({
						title: res.message,
						icon : 'none'
					});
				});
				return ;
			},
			wechatPay(operateId){
				serve.request({
					url: '/order/pay/wechat',
					data:{
						appkey: uni.getStorageSync('appkey'),
						'access-token': uni.getStorageSync('access-token'),
						data_id:operateId,
						data_type : 'order_pay'
					}
				}).then(res => {
					if(res.code != 200) {
						uni.showToast({
							title:res.message,
							icon: 'none'
						});
						return ;
					}
					let payId = res.data.payId;
					let payConfig = res.data.payConfig;
					uni.requestPayment({
						provider: 'wxpay',
						timeStamp: payConfig.timeStamp,
						nonceStr: payConfig.nonceStr,
						package: payConfig.package,
						signType: payConfig.signType,
						paySign: payConfig.paySign,
						success: function (res) {
							// _self.paySuccess(operateId, 'wechat');
							_self.queryPayResult(payId);
							return ;
						},
						fail: function (err) {
							uni.showToast({
								title: '放弃支付',
								icon: 'none'
							});
							return ;
						}
					})
				});
				return ;
			},
			queryPayResult(payId) {
				uni.showLoading({
					title: '支付结果查询中···',
					mask: true
				});
				setTimeout(function() {
					serve.request({
						url: '/payservice/query-pay',
						data:{
							appkey: uni.getStorageSync('appkey'),
							payId: payId,
						}
					}).then(res => {
						if(res.data.payStatus == 1) {
							_self.getInfo();
							_self.$refs.popup.close();
						} else {
							_self.queryPayResult(payId);
						}
					});
				}, 1500);
			},
			calculationTotalMoney() {
				_self.user_hdq = JSON.parse(JSON.stringify(_self.account.user_integral));
				_self.user_tea = JSON.parse(JSON.stringify(_self.account.user_tea));
				var payMoney = _self.payInfo.total_money;
				var totalHdq = 0;
				var totalTea = 0;
				var totalTeaMoney = 0;
				var totalTeaProcess = 0;
				_self.deduction_hdq_money = _self.payInfo.use_hdq;
				_self.deduction_tea_money = _self.payInfo.tea_money;
				_self.check_use_hdq = 0;
				_self.check_use_tea = 0;
				if(_self.deduction_hdq_money > 0 && _self.user_hdq > 0) {
					totalHdq = Number(_self.user_hdq) > Number(_self.deduction_hdq_money) ? Math.ceil(_self.deduction_hdq_money) : _self.user_hdq;
					_self.check_use_hdq = 1;
					if(_self.is_use_hdq) {
						_self.deduction_hdq_money = Number(_self.deduction_hdq_money) - Number(totalHdq);
						_self.deduction_tea_money = Number(_self.deduction_tea_money) - Number(totalHdq);
						payMoney = Number(payMoney) - Number(totalHdq);
					}
					console.info("totalHdq --- " + totalHdq);
				}
				if(_self.deduction_tea_money > 0 && _self.tea_pay_rule.is_use_tea == 1 && _self.user_tea > 0) {
					_self.check_use_tea = 1;
					let nowProcess = _self.numFilter((_self.deduction_tea_money * _self.tea_pay_rule.use_tea_ratio) / 100);
					let nowTea = Number(nowProcess) + Number(_self.deduction_tea_money);
					let nowTeaMoney = _self.deduction_tea_money;
					if(Number(nowTea) > Number(_self.user_tea)) {
						nowTeaMoney = _self.numFilter(_self.user_tea / (Number(1) + Number(_self.tea_pay_rule.use_tea_ratio / 100)));
						nowTea = _self.user_tea;
						nowProcess = _self.numFilter(Number(nowTea) - Number(nowTeaMoney));
					}
					console.info("nowTea --- " + nowTea);
					console.info("nowTeaMoney --- " + nowTeaMoney);
					console.info("nowProcess --- " + nowProcess);
					totalTea = Number(totalTea) + Number(nowTea);
					totalTeaMoney = Number(totalTeaMoney) + Number(nowTeaMoney);
					totalTeaProcess = Number(totalTeaProcess) + Number(nowProcess);
					if(_self.is_use_tea) {
						_self.deduction_tea_money = Number(_self.deduction_tea_money) - Number(totalTeaMoney);
						payMoney = Number(payMoney) - Number(totalTeaMoney);
						if(!_self.is_use_hdq && totalTeaMoney == _self.payInfo.product_zero) {
							_self.check_use_hdq = 0;
						}
					}
				}
				// payMoney = Number(payMoney) + Number(deductionMoney);
				_self.pay_money = _self.numFilter(payMoney);
				_self.use_hdq = _self.numFilter(totalHdq);
				_self.use_tea = _self.numFilter(totalTea);
				_self.tea_money = _self.numFilter(totalTeaMoney);
				_self.tea_process = _self.numFilter(totalTeaProcess);
				_self.$forceUpdate();
			},
			jump(jump_type, jump_link){
				common.jump(jump_type, jump_link);
			}
		},
		onLoad(options) {
			_self = this;
			_self.id=options.id || 0;
			if(_self.id == 0) {
				uni.showToast({
					title: "错误的访问方式",
					icon: 'none',
					success() {
						setTimeout(function () {
							common.jump('return_one')
						}, 2000) 
					}
				});
			}
			_self.getInfo();
		},
		onShow() {
			if(_self.isShow == false){
				return ;
			}
			
			_self.searchMemberInfo();
		},
		onPullDownRefresh() {
			uni.showLoading({
				title: '加载中···',
				mask: true
			});
			_self.getInfo();
		}
	}
</script>

<style scoped lang="scss">
	@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
		    .orderDetails {
		        padding-bottom: 124upx !important;
				.bot{
					 padding-bottom: 12px !important;
					 
				}
		    }
		}
	.orderDetails {
		padding-bottom: 150upx;

		.top {
			position: relative;
			border-bottom: 16upx rgba(251, 251, 253, 1) solid;

			.state {
				position: relative;
				box-sizing: border-box;
				// padding: 58upx 48upx;
				width: 100%;
				height: 250upx;
				// background: #F5F5FE;
				display: flex;
				justify-content: space-between;
				align-items: center;
				position: relative;
				font-size: 48upx;
				font-family: YouSheBiaoTiHei;
				font-weight: bold;
				color: #333333;
				image {
					position: absolute;
					width: 100%;
					height: 250upx;
					z-index: 0;
				}
				.right{
					position: relative;
					z-index: 10;
					display: flex;
					flex-direction: column;
					padding-left: 30upx;
					// width: 280upx;
					.time {
						// position: absolute;
						// bottom: 18upx;
						color: #333333;
						font-size: 20upx;
						font-style:normal;
						font-weight: 400;
						margin-top: 14upx;
					}
				}

				
			}
            .line1{
				box-sizing: border-box;
				display: flex;
				padding: 0upx 30upx;
				height: 130upx;
				align-items: center;
				justify-content: space-between;
				border-bottom: 1upx rgba(53,63,110,0.06) solid;
				.left{
					display: flex;
					align-items: center;
					font-size: 28upx;
					color: #666666;
					image{
						width:40upx;
						height:29upx;
						margin-right: 13upx;
					}
				}
				.right{
					color: #EB5938;
					font-size: 28upx;
					font-weight: bold;
				}
			}

			.img {
				position: absolute;
				bottom: 0;
				height: 10upx;
				width: 100%;
			}
		}

		.goods {
			box-sizing: border-box;
			display: flex;
			align-items: center;
			padding: 40upx 30upx;
			border-bottom: 1upx rgba(235, 236, 240, 1) solid;

			image {
				width: 170upx;
				height: 170upx;
				margin-right: 20upx;
			}

			.right {
				position: relative;
				width: 503upx;
				display: flex;
				// justify-content: center;
				flex-direction: column;
				font-size: 32upx;
				.right-p{
					-webkit-line-clamp: 2;
					overflow: hidden;
					word-break: break-all;
					text-overflow: ellipsis; 
					display: -webkit-box; 
					-webkit-box-orient: vertical; 
				}
				.operate {
					position: absolute;
					right: 0upx;
					bottom: 0upx;
					width: 130upx;
					height: 48upx;
					border: 1px solid #999999;
					border-radius: 24upx;
					text-align: center;
					font-size: 24upx;
					line-height: 48upx;
					font-weight: bold;
					color: #999999;
				}

				.size {
					display: flex;
					justify-content: space-between;
					padding: 20upx 0upx;
					color: #999999;
					font-size: 24upx;
					align-items: center;
				}

				text:first-child {
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				.num {
					font-size: 28upx;
					font-weight: bold;
					color: #FF5F60;
				}
				.num1{
					font-size:20upx;
					font-weight:400;
					text-decoration:line-through;
					color: #CCCCCC;
				}
			}
		}

		.line {
			box-sizing: border-box;
			padding: 37upx 30upx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			font-size: 28upx;
			// font-weight: bold;
			color: #666666;
			border-bottom: 1upx rgba(235, 236, 240, 1) solid;

			text:last-child {
				color: #FF5F60;
				font-size: 32upx;
			}
			.youFei{
				display: flex;
				flex-direction: column;
				align-items: flex-end;
				color: #FF5F60;
				font-size: 32upx;
			}

			;
		}

		.pic {
			box-sizing: border-box;
			padding: 37upx 30upx;
			display: flex;
			justify-content: flex-end;
			align-items: flex-end;
			font-size: 28upx;
			color: #999999;
			border-bottom: 1upx rgba(235, 236, 240, 1) solid;

			text:last-child {
				color: #FF5F60;
				font-size: 32upx;
				font-weight: bold;
			}

			;
		}

		.common {
			box-sizing: border-box;
			padding: 37upx 30upx;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			align-items: flex-start;
			// font-weight: bold;
			font-size: 28upx;
			color: #666666;
			border-bottom: 16upx rgba(251, 251, 253, 1) solid;

			text:last-child {
				max-width: 540upx;
			}

			;
		}
		.contact{
			//background: white;
			height: 100upx;
			width: 400upx;
			box-sizing: border-box;
			// display: inline;
			font-size: 15upx;
			//font-weight: 400;
			border-radius: 50upx;
			//border: 2upx #cccccc solid;
			background-color: #FFFFFF;
			text{
				color: #666666;
			}
		}
		.contact::after{
			content: '';
			border: none;
		}
		.info {
			display: flex;
			flex-direction: column;
			padding: 10upx 30upx;
			font-size: 28upx;
			color: #666666;
			border-bottom: 20rpx #fbfbfd solid;

			text:first-child {
				font-weight: bold;
				margin-top: 0upx;
				color: #333333;
			}

			text {
				font-weight: 400;
				margin-top: 20upx;
			}
			.pickupView{
				display: flex;
				align-items: center;
				padding: 32upx 27upx 32upx 0upx;
				box-sizing: border-box;
				text-align: center;
				view {
					width: 33.3%;
					font-size: 32upx;
					position: relative;
					text-align: center;
				}
			}
		}

		.bot {
			position: fixed;
			width: 100%;
			height: 100upx;
			bottom: 0upx;
			border-top: 1upx #EBECF0 solid;
            padding-bottom: env(safe-area-inset-bottom);
			background-color: #FFFFFF;
			.txt1 {
				box-shadow: 0px 1upx 0px 0px rgba(235, 236, 240, 1);
				width: 100%;
				height: 100%;
				background: #FFBF0A;
				color: #FFFFFF;
				font-size: 28upx;
				text-align: center;
				line-height: 100upx;
				display: flex;
				text {
					background: #FFBF0A;
					color: #FFFFFF;
					height: 100upx;
					line-height: 100upx;
					width: 100%;
				}
			}

			.txt2 {
				box-shadow: 0px 1upx 0px 0px rgba(235, 236, 240, 1);
				display: flex;
				width: 100%;
				height: 100%;

				text {
					height: 100upx;
					line-height: 100upx;
					text-align: center;
					width: 50%;
					font-size: 28upx;
					background: #FFFFFF;
					color: #666666;
				}

				text:last-child {
					background: #FFBF0A;
					color: #FFFFFF;
				}
			}
		}
		.pay_type{
			position: relative;
			width: 100%;
			background: #FFFFFF;
			padding-bottom: 140upx;
			.close{
				position: absolute;
				width:23upx;
				height:23upx;
				right: 40upx;
				top: 45upx;
			}
			.title{
				width: 100%;
				text-align: center;
				height: 100upx;
				line-height: 100upx;
				font-size: 36upx;
				border-bottom: 1upx #EBECF0 solid;
			}
			.paypir{
				display: flex;
				justify-content: center;
				flex-direction: column;
				align-items: center;
				padding: 50upx 0upx 20upx;
				font-size: 28upx;
				color: #FF5F60;
				text:last-child{
					color: #FF5F60;
					font-size: 40upx;
					font-weight: bold;
					margin-top: 10upx;
				}
			}
			.line2{
				width: 100%;
				box-sizing: border-box;
				padding: 36upx;
				display: flex;
				justify-content: space-between;
				font-size: 28upx;
				color: #333333;
				border-bottom: 1upx #EBECF0 solid;
				.txt{
					color: #999999;
				}
				.nosel {
					width: 36upx;
					height: 36upx;
					border: 1upx solid rgba(60, 72, 104, 1);
					border-radius: 50%;
				}
				.sel {
					background-image: url(../../static/img/check.png);
					background-repeat: no-repeat;
					width: 40upx;
					height: 40upx;
					background-size: 100%;
				}
				.nocheck {
					width: 36upx;
					height: 36upx;
					border: 1upx solid rgba(60, 72, 104, 1);
					border-radius: 20%;
				}
				.check {
					background: url(../../static/img/checkbox_check.png);
					background-repeat: no-repeat;
					width: 40upx;
					height: 40upx;
					background-size: 100%;
				}
			}
			.pay_bot {
			  width: 100%;
			  position: fixed;
			  left: 0;
			  bottom: 0;
			  height: 100upx;
			  background: #FFBC00;
			  color: #fff;
			  font-size: 32upx;
			  line-height: 100upx;
			  text-align: center;
			  border-radius: 0;
			  &::after{
				  border: none;
			  }
			}
		}
		.pickupCode-box{
			width: 80vw;
			background: #fff;
			border-radius: 8rpx;
			.title{
				width: 100%;
				    text-align: center;
				    color: #333333;
				    height: 100rpx;
				    line-height: 100rpx;
				    font-size: 36rpx;
			}
			.img{
				width: 480rpx;
				    height: 48rrpx;
				    position: relative;
				    left: 50%;
				    margin-left: -240rpx
			}
			.pickupCode-t{
				    width: 100%;
				    text-align: center;
				    height: 60rpx;
				    line-height: 60rpx;
				    letter-spacing: 8rpx;
				    font-size: 40rpx;
			}
			.btn{
				    width: 100%;
				    height: 100rpx;
				    text-align: center;
				    line-height: 100rpx;
				    font-size: 32rpx;
				    color: #333333;
			}
		}
		.address {
			display: flex;
			position: relative;
			padding: 53upx 70upx;
			font-size: 28upx;
			align-items: center;
			color: #666666;

			image {
				position: absolute;
				left: 30upx;
				width: 31upx;
				height: 37upx;
				top: 120upx;
			}

			.txt {
				display: flex;
				justify-content: space-between;
				padding-bottom: 28upx;
			}

			.jt {
				position: absolute;
				right: 30upx;
				top: 105upx;
				content: '';
				border: 1upx solid rgba(57, 72, 107, 0.5);
				border-width: 0 3upx 3upx 0;
				padding: 6upx;
				transform: rotate(-45deg);
				-webkit-transform: rotate(-45deg);
			}
		}
	}
</style>
